package cn.stylefeng.guns.sys.modular.metadata.mapper;

import cn.stylefeng.guns.sys.modular.metadata.entity.Metadata;
import cn.stylefeng.guns.sys.modular.metadata.model.params.MetadataParam;
import cn.stylefeng.guns.sys.modular.metadata.model.result.MetadataResult;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 元数据管理表 Mapper 接口
 * </p>
 *
 * @author author
 * @since 2020-11-17
 */
public interface MetadataMapper extends BaseMapper<Metadata> {

    /**
     * 获取列表
     *
     * @author author
     * @Date 2020-11-17
     */
    List<MetadataResult> customList(@Param("paramCondition") MetadataParam paramCondition);

    /**
     * 获取map列表
     *
     * @author author
     * @Date 2020-11-17
     */
    List<Map<String, Object>> customMapList(@Param("paramCondition") MetadataParam paramCondition);

    /**
     * 获取分页实体列表
     *
     * @author author
     * @Date 2020-11-17
     */
    Page<MetadataResult> customPageList(@Param("page") Page page, @Param("paramCondition") MetadataParam paramCondition);

    /**
     * 获取分页map列表
     *
     * @author author
     * @Date 2020-11-17
     */
    Page<Map<String, Object>> customPageMapList(@Param("page") Page page, @Param("paramCondition") MetadataParam paramCondition);


    /**
     * 逻辑删除
     *
     * @param id
     * @return
     */
    int deleteMetadata(@Param("id") Integer id);

    /**
     * 获取分页元数据查看数据
     *
     * @author author
     * @Date 2020-11-17
     */
    List<Map<String, Object>> queryMetadataDetail(@Param("paramCondition") MetadataParam paramCondition, @Param("beforeLimit") Integer beforeLimit, @Param("afterLimit") Integer afterLimit);


    /**
     * 获取自动建表
     *
     * @param paramCondition
     */
    List<String> queryCreatTable(@Param("paramCondition") MetadataParam paramCondition);


    /**
     * 建表语句
     *
     * @param sql
     */
    void createTable(@Param("sql") String sql);

}
